<%
# Copyright (C) 2013 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% if @quiz.description && !@quiz.description.empty? %>
  <div class="description user_content teacher-version"><%= public_user_content(@quiz.description) %></div>
<% end %>

<form class="form-horizontal bootstrap-form display-only" style="margin-top:18px;">
  <fieldset>
    <div class="control-group">
      <div class="control-label">
        {{#t}}Quiz Type{{/t}}
      </div>
      <div class="controls">
        <span class="value"><%= render_quiz_type(@quiz.quiz_type) %></span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        {{#t}}Points{{/t}}
      </div>
      <div class="controls">
        <span class="value"><%= points_possible_display %></span>
      </div>
    </div>

    <% if @quiz.graded? && @quiz.assignment_group.present? %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Assignment Group{{/t}}
        </div>
        <div class="controls">
          <span class="value"><%= @quiz.assignment_group.name %></span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        {{#t}}Shuffle Answers{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.shuffle_answers ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        {{#t}}Time Limit{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <% if @quiz.time_limit %>
            <%= t(:time_limit, "Minute", :count => @quiz.time_limit + ((@submission && @submission.extra_time) || 0)) %>
          <% else %>
            {{#t}}No Time Limit{{/t}}
          <% end %>
        </span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        {{#t}}Multiple Attempts{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.single_attempt? ? t('#options.no', "No") : t('#options.yes', "Yes") %>
        </span>
      </div>
    </div>

    <% unless @quiz.single_attempt? %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Score to Keep{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= render_score_to_keep(@quiz.scoring_policy) %>
          </span>
        </div>
      </div>

      <div class="control-group">
        <div class="control-label">
          {{#t}}Attempts{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.unlimited_attempts? ? "Unlimited" : @quiz.allowed_attempts %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        {{#t}}View Responses{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <%= render_show_responses(@quiz.hide_results) %>
        </span>
      </div>
    </div>

    <% if @quiz.hide_results != 'always' %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Show Correct Answers{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= render_show_correct_answers(@quiz) %>
          </span>
        </div>
      </div>
    <% end %>

    <% unless @quiz.access_code.blank? %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Access Code{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.access_code %>
          </span>
        </div>
      </div>
    <% end %>

    <% unless @quiz.ip_filter.blank? %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}IP Filter{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.ip_filter %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        {{#t}}One Question at a Time{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.one_question_at_a_time? ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>

    <% if feature_enabled?(:lockdown_browser) %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Require Respondus LockDown Browser{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.require_lockdown_browser ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>

      <div class="control-group">
        <div class="control-label">
          {{#t}}Required to View Quiz Results{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.require_lockdown_browser_for_results ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>
      <% if @quiz.lockdown_browser_use_lti_tool? %>
        <div class="control-group">
          <div class="control-label">
            {{#t}}Webcam Required{{/t}}
          </div>
          <div class="controls">
            <span class="value">
              <%= @quiz.require_lockdown_browser_monitor ? t('#options.yes', "Yes") : t('#options.no', "No") %>
            </span>
          </div>
      	</div>
      <% end %>
    <% end %>

    <% if @quiz.one_question_at_a_time %>
      <div class="control-group">
        <div class="control-label">
          {{#t}}Lock Questions After Answering{{/t}}
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.cant_go_back ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group" style="<%= hidden unless @quiz.survey? %>">
      <div class="control-label">
        {{#t}}Anonymous Submissions{{/t}}
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.anonymous_submissions ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>
  </fieldset>
</form>

<table class="ic-Table assignment_dates">
  <thead>
    <tr>
      <th scope="col">{{#t}}Due{{/t}}</th>
      <th scope="col">{{#t}}For{{/t}}</th>
      <th scope="col">{{#t}}Available from{{/t}}</th>
      <th scope="col">{{#t}}Until{{/t}}</th>
    </tr>
  </thead>

  <%= render 'shared/override_list', :assignment => @quiz,
    :user => @current_user %>

</table>
